<?php
define('AUTH_ID',"AUTH_ID");
define('AUTH_NAME',"AUTH_NAME");
define('AUTH_LEVEL',"AUTH_NAME");

/**
 * Verifie l'authentification par la variable Session
 * name: AuthBySession
 * TODO? vérifier concordance id<->name
 */
function AuthBySession(){
	return (isset($_SESSION[AUTH_ID]) &&
			isset($_SESSION[AUTH_NAME]) &&
			isset($_SESSION[AUTH_LEVEL]));
}

function AuthByCookie(){
	return False;
}

function AuthByForm($nom,$mdp,$stay){
}

function UserToKey($nom,$mdp){
	return sha1('bpc'.strtoupper($nom).$mdp.date('d-m-Y'));
}

function CheckAuth(){
	global $tab_request;
/*
	if ( $tab_request['mode']!='login' )
		if ( !AuthBySession() )
			if ( !AuthByCookie() )
				if ( !AuthByForm() )
					return False;
*/
	return True;
}
?>
